import { EventService } from 'src/app/shared/service/event.service';
import { Component, Input, OnInit } from '@angular/core';

@Component({
  selector: 'app-clean-page',
  templateUrl: './clean-page.component.html',
  styleUrls: ['./clean-page.component.scss'],
})
export class CleanPageComponent implements OnInit {

  @Input() tagData;
  tags: any;

  constructor(
    private eventService: EventService,

  ) { }

  ngOnInit() {
    if (this.tagData.data.head.action === 'price') {
      if (this.eventService.eventEmit.listenerCount('updateCleanerShopOrdersAmount') > 0) {
        this.eventService.eventEmit.removeListener('updateCleanerShopOrdersAmount');
      }
    }

    this.eventService.eventEmit.on('updateCleanerShopOrdersAmount', res => {

        this.tagData.data.head.price = res + '';
    });
    try {
      this.tags = this.tagData.data.head.tags.split(',');
    } catch (error) {

    }
  }

}
